/*
 *   Copyright (C) <2009> 
 *
 *   <Sandeep K Sinha>
 *   <Rishi B Agrawal> <Vineet Agarwal> <Rohit Vashist> <Rohit K Sharma> <Sneha Hendre> 
 *   
 *   <sandeepksinha@gmail.com> <rishi.b.agrawal@gmail.com> <checkout.vineet@gmail.com> 
 *   <rohit.k.vashist@gmail.com> <imreckless@gmail.com> <sneha.hendre@gmail.com>
 *
 *   This program is free software: you can redistribute it and/or modify it 
 *   under the terms of the GNU General Public License as published by the 
 *   Free Software Foundation, either version 3 of the License, or (at your 
 *   option) any later version->
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE->  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *    
 */
#include<linux/module.h>
#include<linux/kernel.h>
#include<linux/types.h>

#define DEBUG	/* if defined then debug on */

#ifdef DEBUG
#define ohsm_printk(x...) printk(KERN_DEBUG x)
#else
#define ohsm_printk(x...) do { } while(0) 
#endif

#define OHSM_ADMIN_ERROR 1 
#define OHSM_SET_POLICY 1 
#define MAX_TIER 10 
#define MAX_DISK 10 
#define MAX_DISK_ALLOWED 11 
#define MAX_MNT_LEN 20 
#define map_info_ready_t unsigned char 
#define table_ready_t unsigned char 

char ohsm_mountpoint[MAX_MNT_LEN];
int ohsm_relocating = UNSET;
unsigned int Major;

map_info_ready_t mapper_flag = FALSE;
table_ready_t map_table_flag = FALSE; 

struct ohsm_struct_rules *rules = NULL;
struct nameidata nd;
struct ext2_sb_info *ohsm_sbi = NULL;
struct ohsm_relocatable_inode *list_inodes = NULL;
struct ohsm_struct_for_ioctl *ohsm_admin_info = NULL;
struct ohsm_struct_rules *reloc_policy_t = NULL;
struct ohsm_device_info *devices;
struct ohsm_tier_dev_info *dev_info;
struct ohsm_reloc_policy *relocpol;
extern int ohsm_enabled;
extern unsigned long sam[MAX_TIER_ALLOWED][MAX_DISK_ALLOWED * 2 + 1];
extern struct ohsm_allocation_policy *alloc_policy;
extern struct super_block *ohsm_sb;
extern struct buffer_head *read_inode_bitmap (struct super_block *,unsigned long);
//extern int ohsm_set_dm_info_table(struct ohsm_disk_info **mapper_table);
void debug_print_sam(void);

int ohsm_sync_inode(struct inode *inode) {
        struct writeback_control wbc = {
                .sync_mode = WB_SYNC_ALL,
                .nr_to_write = 0,       
        };
        return sync_inode(inode, &wbc);
}
unsigned char ohsm_get_tier (struct dentry *);
struct ohsm_allocation_policy *allocpol; 
extern unsigned char (*ohsm_get_tier_fptr)(struct dentry *);
